package session;

import com.sun.scenario.effect.impl.sw.java.JSWBlend_SRC_OUTPeer;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

/**
 * 韩要雷
 */
@WebServlet("/session01")
public class Session01 extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        //获取session对象
        HttpSession session = req.getSession();

        //会话标识符
        System.out.println("会话标识符" + session.getId());

        //会话创建时间
        System.out.println("会话创建时间" + session.getCreationTime());

        //最后一次访问时间
        System.out.println("最后一次访问时间" + session.getLastAccessedTime());

        //是否是新的会话
        System.out.println("是否是新的会话" + session.isNew());


    }
}
